import { getAxios } from "../util/HttpUtil"

export namespace OrderGoodsRequest {
/**
 * 插入订单单品列表
 * @param orderGoodsList
 * @return
 */
  export function insertOrder(orderGoods: OrderGoods[]) {
    let url = "/order/addOrderGoods";
    return getAxios().post(url, orderGoods)
  }

  /**
   * 查找所有订单列表
   * @param storeId
   * @param orderId
   * @returns
   */
  export function getOrders(storeId) {
    let url = "/order/" + storeId;
    return getAxios().get(url);
  }
}

  export class OrderGoods {

  /**
   * 订单id
   */
  orderId?: number;
  /**
   * 订单项唯一的ID
   */
  orderGoodsId?: number;
  /**
   * 订单产品唯一的ID
   */
  goodsId?: number;
  /**
   * 商品名
   */
  goodsName: string
  /**
   * 商品重量(数量)
   */
  goodsWeight: string
  /**
   * 成交时的商品单价
   */
  goodsPrice: number
  /**
   * 商品单位()
   */
  goodsUnit?: string;
  /**
   * 商品总价
   */
  goodsTotalPrice?: number
  /**
   * 商户ID
   */
  storeId?: number
  /**
   * 状态
   */
  status?: number
  /**
   * 创建日期
   */
  createdTime?: string
  /**
   * 更新日期
   */
  updateTime?: string

  constructor(goodsName?: string, goodsWeight?: string, goodsPrice?: number, goodsUnit?: string, createdTime?: string, updateTime?: string) {

    if (goodsName || goodsWeight || goodsPrice || goodsUnit || createdTime || updateTime) {
      this.goodsName = goodsName
      this.goodsWeight = goodsWeight
      this.goodsPrice = goodsPrice
      this.goodsUnit = goodsUnit
      this.createdTime = createdTime
      this.updateTime = updateTime
    } else {
      //无参构造器
    }

  }
}


